cmake_minimum_required(VERSION 3.5)

include_directories(${PROJECT_SOURCE_DIR}/test)

message("proj_src_dirs:${PROJECT_SOURCE_DIR}")
message("CMAKE_CURRENT_SOURCE_DIR:${CMAKE_CURRENT_SOURCE_DIR}")

add_executable(test_rshift test_rshift.c)

add_executable(test_mod    test_mod.c)

add_executable(test_float  test_float.c)

add_executable(test_float_cvt  test_float_cvt.c)
add_custom_target(  # For check asm code
  test_float_cvt_asm
  ALL
  COMMAND gcc -S -masm=intel -mavx -O2 ${CMAKE_CURRENT_SOURCE_DIR}/test_float_cvt.c
    -o ${PROJECT_BINARY_DIR}/test_float_cvt.avx.asm
)

add_executable(test_int64mul  test_int64mul.c)
add_custom_target( # For check asm code
  test_int64mul_asm
  ALL
  COMMAND gcc -S -masm=intel -O2 ${CMAKE_CURRENT_SOURCE_DIR}/test_int64mul.c
    -o ${PROJECT_BINARY_DIR}/test_int64mul.asm
)

add_executable(test_fixpoint_mul  test_fixpoint_mul.c)

add_custom_target( # For check asm code
  test_fixpoint_mul_asm
  ALL
  COMMAND gcc -S -masm=intel -O2 ${CMAKE_CURRENT_SOURCE_DIR}/test_fixpoint_mul.c
    -o ${PROJECT_BINARY_DIR}/test_fixpoint_mul.asm
)

add_executable(test_glib_exp test_exp.c)
target_link_libraries(test_glib_exp m quadmath myexp)
target_compile_definitions(test_glib_exp PUBLIC TEST_EXP_V0)

add_executable(test_exp_v1 test_exp.c)
target_link_libraries(test_exp_v1 m quadmath myexp)
target_compile_definitions(test_exp_v1 PUBLIC TEST_EXP_V1)

add_executable(test_exp_v2 test_exp.c)
target_link_libraries(test_exp_v2 m quadmath myexp )
target_compile_definitions(test_exp_v2 PUBLIC TEST_EXP_V2)

add_executable(test_exp_v3 test_exp.c)
target_link_libraries(test_exp_v3 m quadmath myexp)
target_compile_definitions(test_exp_v3 PUBLIC TEST_EXP_V3)

add_executable(test_perf_counter test_perf_counter.c)

add_executable(perf_exp perf_exp.c)
target_link_libraries(perf_exp m myexp)

add_executable(test_exp_vec4 test_exp_vec.c)
target_compile_definitions(test_exp_vec4 PUBLIC TEST_EXP_VEC)
target_link_libraries(test_exp_vec4 myexp m quadmath myexp)


